home *** CD-ROM | disk | FTP | other *** search
- unit Fmissue;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, DB, DBTables;
-
- type
- TfrmIssue = class(TForm)
- GroupBox1: TGroupBox;
- Label1: TLabel;
- edtNumber: TEdit;
- Label2: TLabel;
- edtAmount: TEdit;
- btnPost: TButton;
- btnCancel: TButton;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure btnPostClick(Sender: TObject);
- private
- public
- CustomerNo: LongInt;
- procedure PopulateForm;
- end;
-
- var
- frmIssue: TfrmIssue;
-
- function ShowCreditIssueDlg(aCustomerNo: LongInt): TModalResult;
-
- implementation
-
- {$R *.DFM}
-
- uses
- dmData;
-
- function ShowCreditIssueDlg(aCustomerNo: LongInt): TModalResult;
- begin
- Application.CreateForm(TfrmIssue, frmIssue);
- try
- with frmIssue do begin
- CustomerNo := aCustomerNo;
- PopulateForm;
- Result := ShowModal;
- end;
- finally
- frmIssue.Release;
- end;
- end;
-
- procedure TfrmIssue.PopulateForm;
- begin
- with dmDataModule.spCreditNew do begin
- ParamByName('iCreditNo').Clear;
- ParamByName('iCustNo').AsInteger := CustomerNo;
- ExecProc;
- edtNumber.Text := IntToStr(ParamByName('oCreditNo').AsInteger);
- end;
- end;
-
- procedure TfrmIssue.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- Action := caFree;
- end;
-
- procedure TfrmIssue.btnPostClick(Sender: TObject);
- begin
- with dmDataModule.qryCreditIssue do begin
- ParamByName('CreditNo').AsInteger := StrToInt(edtNumber.Text);
- ParamByName('Amount').AsFloat := StrToFloat(edtAmount.Text);
- ExecSQL;
- end;
- end;
-
- end.
-